//
//  YTMyFooterView.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/8/14.
//

#import "YTMyFooterView.h"
@interface YTMyFooterView ()
@property (nonatomic ,strong) UIView * szview;

@property (nonatomic ,strong) UIView * ckview;
@property (nonatomic ,strong) UIView * xgview;


@end
@implementation YTMyFooterView
+ (instancetype)NewView {
    YTMyFooterView * view = [YTMyFooterView new];
    view.clipsToBounds = YES;
    [view newUI];
    return view;
}
- (void)newUI{
    MJWeakSelf
    UIView * ckview = [UIView new];
    self.ckview = ckview;
    ckview.addClickBlock(^{
        if(weakSelf.openCKBlock){
            weakSelf.openCKBlock();
        }
    });
    
    ckview.backgroundColor = UIColor.whiteColor;
    [self addSubview:ckview];
    [DTKTool YJ:kwt(5) andView:ckview];
    [ckview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(10));
        make.top.offset(0);
        make.right.offset(kwt(-10));
        make.height.offset(kwt(58));
    }];
    
    UIImageView * ckimg = kimageView(@"warehouse2");
    [ckview addSubview:ckimg];
    [ckimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(18));
        make.centerY.offset(0);
        make.height.width.offset(kwt(22));
    }];
    
    UILabel * cklab = [DTKTool labelWithText:@"出库记录" andFont:kFont(18) andTextColor:KcolorHex(@"#222222")];
    [ckview addSubview:cklab];
    [cklab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(49));
        make.centerY.offset(0);
    }];
    UIImageView * ckrightimg = kimageView(@"template_enter");
    [ckview addSubview:ckrightimg];
    [ckrightimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(kwt(-17));
        make.centerY.offset(0);
        make.height.width.offset(kwt(16));
    }];
    
    
    
    UIView * szview = [UIView new];
    self.szview = szview;
    szview.addClickBlock(^{
        [weakSelf openSZ];
    });
    
    szview.backgroundColor = UIColor.whiteColor;
    [self addSubview:szview];
    [DTKTool YJ:kwt(5) andView:szview];
    [szview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(10));
        if([UserInfoModel shared].userIdentity == 3){///员工
            make.top.offset(kwt(68));
        } else  {
            make.top.offset(0);
        }
        make.right.offset(kwt(-10));
        make.height.offset(kwt(58));
    }];
    
    UIImageView * szimg = kimageView(@"install");
    [szview addSubview:szimg];
    [szimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(18));
        make.centerY.offset(0);
        make.height.width.offset(kwt(22));
    }];
    
    UILabel * zslab = [DTKTool labelWithText:@"修改密码" andFont:kFont(18) andTextColor:KcolorHex(@"#222222")];
    [szview addSubview:zslab];
    [zslab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(49));
        make.centerY.offset(0);
    }];
    UIImageView * szrightimg = kimageView(@"template_enter");
    [szview addSubview:szrightimg];
    [szrightimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(kwt(-17));
        make.centerY.offset(0);
        make.height.width.offset(kwt(16));
    }];
    
    
    
    UIView * tcview = [UIView new];
    tcview.addClickBlock(^{
        [weakSelf openTC];
    });
    tcview.backgroundColor = UIColor.whiteColor;
    [self addSubview:tcview];
    [DTKTool YJ:kwt(5) andView:tcview];
    [tcview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(10));
        make.top.equalTo(szview.mas_bottom).offset(kwt(10));
        make.right.offset(kwt(-10));
        make.height.offset(kwt(58));
    }];
    
    UILabel * tclab = [DTKTool labelWithText:@"退出登录" andFont:kFont(17) andTextColor:KcolorHex(@"#686868")];
    [tcview addSubview:tclab];
    [tclab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.offset(0);
    }];
 
    
}

- (void)openSZ{
    if(self.openSZBlock){
        self.openSZBlock();
    }
}
- (void)openTC{
    if(self.exitBlock){
        self.exitBlock();
    }
}
@end
